package main

import "fmt"

//要求Square必须全部实现Shaper的接口
var _ Shaper = (*Square)(nil)

//定义形状接口
type Shaper interface {
	Area() float32
	Volume() float32
}

type Square struct {
	side float32
}

func (s *Square) Area() float32 {
	return s.side * s.side
}

func (s *Square) Volume() float32 {
	return s.side
}

func main() {
	sq := new(Square)
	sq.side = 5

	var shaper Shaper

	shaper = sq

	res := shaper.Area()
	fmt.Println(res)

}
